package com.ym.utils.exception.sentinel;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.ym.utils.exception.CustomException;
import com.ym.utils.restful.AjaxJson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BlockHandlerException {
    private final static Logger log = LoggerFactory.getLogger(BlockHandlerException.class);

    public static AjaxJson blockHandler(BlockException ex) {
        log.error("{}", ex);
        return new AjaxJson().ErrorException(new CustomException(500,"接口被限流或者降级了..."));
    }
}
